3. add verified updates and rollback for compiled installs - #2166
Conversation
Refs ENG-6047; fixes #2166
Refs ENG-6047; fixes #2166
Prime Agent performance — completedPR Overall: 0 regressed · 0 improved · 17 no clear change.
Python runtime
Sandbox cost: ~$0.0691 — no inference calls. Methodology and samplesMain resolved at 2026-09-12T08:53:52.658864+00:00. Harness
|
Refs ENG-6047; fixes #2166
Refs ENG-6047; fixes #2166
a52ce21 to
2033db2
Compare
2033db2 to
289b2ce
Compare
289b2ce to
4164228
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4164228. Configure here.

This is part of the PR stack migrating us to use Bun to compile Prime Agent for releases. This makes supported installations self-contained, removing the need to download and install Node.js and npm packages separately.
This PR adds updates and rollback for compiled installations. Users update through the usual command, downloads are checked before activation, and restarted sessions use the new version. Prime Agent keeps the previous compiled release so users can switch back without downloading it again.
Tested updates between simulated Bun-compiled releases, offline rollback, corrupt downloads, simultaneous updates, and interrupted updates. The combined stack passed 109 of 110 scenarios; the remaining case was the existing npm 12 restriction, with tested recovery. Forced termination can require manual recovery. The final release-metadata fix passed 44 targeted tests.
ENG-6047 · Stack: #2140 → #2165 → #2166.
Note
Add verified updates and offline rollback for compiled native installs
rollbackcommand to install.sh that restores a validated previous compiled release without downloading. Theupdatecommand now accepts--rollbackfor Bun-compiled self-updates throughgetSelfUpdatePlanin package-manager-cli.ts..activation-statefile with intended current and previous targets, enabling recovery after interrupted link replacements. Root preparation and cleanup now recover interrupted activations, sweep orphan staging directories, and prune eligible inactive releases.config.getUpdateInstructionreturns the application update command for Bun binaries with a detected native installation. Release manifests can carry validated native binary artifacts viagetLatestPiReleasein version-check.ts.readNativeRollbackInstallationthrows on ambiguous activation state instead of guessing;parsePackageCommandrejects--rollbackcombined with extension targets or non-self sources;prime_agent_native_valid_targetnow rejects release paths that do not match the strict version/platform/digest naming format, which may break manually-created release directories that previously passed the looser path-shape check.Macroscope summarized dd43e70.
Note
High Risk
Changes core install/update/rollback and launcher activation paths; stricter release naming and validation can reject previously tolerated layouts, and failed recovery depends on manual lock/state cleanup.
Overview
Adds self-update and offline rollback for managed compiled installs:
prime-agent update(and/update) can fetch a checksum-verified archive or runinstall.sh --rollbackto swap launchers without re-downloading.The shell installer gains durable
.activation-statejournaling before symlink changes, automatic recovery on the next run, stricter release-dir validation (assets, checksum marker, version/help probes with a 10s timeout), optionalPRIME_AGENT_EXPECTED_*guards for planned updates, and conservative pruning of orphan staging dirs and inactive releases whenlsofshows the binary unused.The CLI wires
--rollbackthrough package self-update, plans native updates viagetNativeUpdatePlan(release manifestbinaries+ SHA-256), and relaunches post-update through the managed launcher instead of the running binary. Release metadata parsing keeps npm update paths working when native entries are invalid.Docs, changelog, CI (including probe-timeout tests), and broad installer/regression tests cover interrupted activation, damaged releases, and daemon restart behavior.
Reviewed by Cursor Bugbot for commit dd43e70. Bugbot is set up for automated code reviews on this repo. Configure here.